<template>
  <div class="swiper-container coupon-list" ref="couponList">
    <div class="swiper-wrapper">
      <div class="swiper-slide">
        <CouponItem
          :coupon="coupon"
          v-for="(coupon, i) in list"
          @change="coupon.status = 1"
          :key="i"
        />
      </div>
    </div>
  </div>
</template>

<script>
import Swiper from "swiper";
import "swiper/swiper.min.css";
import CouponItem from "@/components/CouponItem/CouponItem.vue";

export default {
  name: "CarIndex",
  components: { CouponItem },
  props: {
    list: Array,
  },
  data() {
    return {
      swiper: null,
    };
  },
  mounted() {
    this.swiper = new Swiper(this.$refs.couponList, {
      direction: "horizontal",
      roundLengths: true,
      slidesPerView: "auto",
      freeMode: true,
      mousewheel: true,
    });
  },
};
</script>

<style lang="scss" scoped>
.coupon-list {
  flex: 1;
  width: 0;
  .swiper-slide {
    width: auto;
    ::v-deep {
      .coupon-item {
        display: inline-block;
        line-height: 26px;
      }
    }
  }
}
</style>
